Skip to main content

Create Modal

New Modal Creation

In this interface, you can create a New Modal which defines the structure and schema for your table. A modal acts as the blueprint for the table's properties, ensuring that the fields are properly defined, along with their data types and constraints. This guide walks you through the different elements of the New Modal interface.

Interface Overview

  1. Modal Name:

    • This field allows you to specify a name for the modal. The modal name represents the overall schema or entity you are defining.
    • Example: Modal 1 in the image represents a basic modal with fields Property 1, name, and age.
  2. Property Name:

    • Property names represent the fields (columns) of your modal. Each property will have its own unique name.
    • Example: Property 1, name, and age are the properties in the modal.
  3. Data Type:

    • Defines the type of data the field will hold. The data type ensures that each property holds data in the correct format.
    • Available data types include:
      • String: For textual data such as names or descriptions.
      • Number: For numeric data such as ages, quantities, or IDs.
      • Boolean: For true/false values, commonly used for status flags.
      • Any: Accepts any type of data, offering flexibility when the data type is not known or can vary.
      • Array: Stores a list of values, often used when a field holds multiple related items.
      • Object: Stores key-value pairs, representing more complex structured data.
      • BigInt: For very large integers, often used for precise numerical operations that exceed the range of standard Number types.
    • Example: In the image, the data types are Boolean, String, and Number for the respective properties.
  4. Properties:

    • This section allows you to configure constraints and validation for each field.
    • You can add multiple properties to a field such as Not Null, Optional, Relation Key, Max Value, and Min Value.

    Property Options Explained:

    • Not Null: Ensures that the field cannot have null or empty values.
    • Optional: Allows the field to have null or empty values.
    • Relation Key: Defines the field as a foreign key, linking it to another table.
    • Max Value: Specifies the maximum allowed value for a numeric field.
    • Min Value: Specifies the minimum allowed value for a numeric field.
    • Example:
      • The field name has Relation Key defined, indicating it's linked to another table.
      • The field age has a Max Value of 10, Min Value of 1, and is marked as Optional but also Not Null, which indicates a flexible configuration for the field's validation.
  5. Add New Property:

    • Click this button to add a new field (property) to the modal. This allows you to keep extending the schema by defining additional fields and their properties.
  6. Actions Available:

    • Save: Saves the modal, applying the defined schema to the table in the database.
    • Cancel: Discards changes made to the modal and returns to the previous screen without saving.

Example Modal Configuration:

Property NameData TypeProperties
employee_idNumberNot Null, Auto Increment, Primary Key
employee_nameStringNot Null
skillsArrayOptional
department_idNumberRelation Key (links to departments table)
hire_dateDateNot Null, Optional
salary_detailsObjectOptional, Stores structured key-value data
is_activeBooleanDefault True
large_salaryBigIntNot Null

Explanation:

  • The employee_id field is a unique identifier with Auto Increment and Primary Key properties.
  • The department_id field is a foreign key (relation key) that links to the departments table.
  • The skills field is an Array, which allows you to store multiple skills related to the employee.
  • The salary_details field is an Object, which stores structured data like salary breakdown (e.g., base salary, bonuses).
  • The large_salary field is of type BigInt, which is used for very large numbers, ensuring accuracy for large salary amounts.

Benefits of Using Different Data Types:

  • String: Ideal for storing textual information like names and addresses.
  • Number: Perfect for numeric values, IDs, and quantities.
  • Boolean: Simplifies managing flags like is_active, which can either be true or false.
  • Any: Offers flexibility in cases where data types are uncertain or dynamic.
  • Array: Useful when you need to store multiple values related to a single field (e.g., multiple skills, tags).
  • Object: Allows you to store complex data as key-value pairs (e.g., employee's salary breakdown).
  • BigInt: Ensures accurate calculations and storage for very large numbers, exceeding the limit of standard Number types.

This modal creation interface simplifies the process of defining database schemas with comprehensive options for field types and validation, ensuring flexibility, data integrity, and ease of management.